home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / dnet / dshterm1_0.lha / lib / st / examples / fpf_test.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-04  |  1.2 KB  |  50 lines

  1. #include "needed.h"
  2. #include <exec/tasks.h>
  3.  
  4. char data[10000];
  5.  
  6. main() {
  7. int i;
  8. char test[40], j = 'y';
  9.     for(i = 0; i < 40; i++) test[i] = 'a';
  10.  
  11.     i = spf(test,20,"Hello there people %ld %ld %s!\n",10,20,"yeah yeah");
  12.     strupper(test);
  13.     fpf(Output(),"Yeah this is %ld %s %lc %08lx%08lx\n",i, test, j,
  14.                     *(long *)(&test[16]), *(long *)(&test[20]) );
  15.  
  16.     if(BCmp("Yeah1234567890","Yeah1234567890",10))
  17.         fpf(Output(),"As expected strings are the same\n");
  18.  
  19.     if(!BCmp("Yweah1234567890","Yeah1234567890",10))
  20.         fpf(Output(),"As expected strings are different\n");
  21.  
  22.     BSet(data,5000,'a');
  23.     BMov(data,&data[500],5000);
  24.     data[8432] = 'b';
  25.     BMov(&data[8001], &data[6000], 2000);
  26.     fpf(Output(),"%lc %08lx %lc\n",data[381],data[5432],data[6431]);
  27.  
  28. /*    SignalTest(); */
  29.  
  30.     return(0);
  31. }
  32.  
  33.  
  34. /** following doesn't seem to work
  35. #define SIGS SIGBREAKF_CTRL_C|SIGBREAKF_CTRL_D|SIGBREAKF_CTRL_E|SIGBREAKF_CTRL_F
  36. void MagicFunction(void) {
  37.     fpf(Output(),"Signal received...\n");
  38. }
  39. void SignalTest(void) {
  40. long oldsignals;
  41. struct Task *ourtask;
  42.     oldsignals = SetExcept(0,0);
  43.     ourtask = FindTask(NULL);
  44.     ourtask->tc_ExceptCode = (APTR)&MagicFunction;
  45.     oldsignals = SetExcept(SIGS,SIGS);
  46.     fpf(Output(),"oldsignals = %04lx, mask = %04lx \n",oldsignals, SIGS);
  47.     Delay(20*50);
  48. }
  49. */
  50.